home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_361 / xcolor-lib / colourrequester.doc < prev    next >
Text File  |  1992-05-06  |  6KB  |  209 lines

  1.  
  2.    ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  3.    ­­                                                                ­­
  4.    ­­                ColourRequester - XColor library                ­­
  5.    ­­                                                                ­­
  6.    ­­                                                                ­­
  7.    ­­                        Roger Fischlin                          ­­
  8.    ­­                        Steigerwaldweg 6                        ­­
  9.    ­­                        6450 Hanau 7                            ­­
  10.    ­­                        West Germany                            ­­
  11.    ­­                                                                ­­
  12.    ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  13.  
  14. ; sorry for any mistake but it 2 o'clock in the morning....
  15.  
  16.  
  17.  
  18. To run the ColourRequester you need a structure . This structure also
  19. contains a few vectors for inserting own routines.
  20.  
  21.  
  22.  
  23. ColourRequester structure
  24. ­­­­­­­­­­­­­­­­­­­­­­­­­
  25.  
  26.  
  27. CR_Screen        : pointer to screen
  28.  
  29. CR_TextColour    : pen used for writing text
  30.  
  31. CR_BackColour    : background pen
  32.  
  33. CR_GBorderColour : pen for gadget boxes
  34.  
  35. CR_GTextColour   : pen used for writing gadget texts
  36.  
  37. CR_Flags         : some flags:
  38.  
  39.                    FLAG_HSV           :use HSV instead of RGB
  40.                    FLAG_RGB           :use RGB
  41.                    FLAG_HEX           :use hexadecimal numbers
  42.                    FLAG_NORMAL        :use decimal numbers
  43.                    FLAG_NOWINDOWDEPTH :window cannot be moved
  44.                    FLAG_NOWINDOWDRAG  :window cannot be pushed to the
  45.                                        background.
  46.  
  47. CR_LeftEdge      : left edge
  48.  
  49. CR_TopEdge       : top edge
  50.  
  51. CR_Font          : pointer to font, used for calling OpenFont. If it's
  52.                    0 the default font is used. The font should be 8x8.
  53.  
  54. CR_DefaultEntries: number of entries in default colortable
  55.  
  56. CR_Default-      : pointer to default colortable or 0
  57.    ColorMap
  58.  
  59. CR_JMPWindow ¹   : ColourRequester will jump to that address (d0=^NewWindow)
  60.                    before the window is opened.
  61.  
  62. CR_JMPMessage ¹  : ColourRequester will jump to that address if it receives 
  63.                    an unknown message.
  64.  
  65.  
  66. CR_JMPMode ¹     : ColourRequester will jump to that address 
  67.                    (d0= selected colour) if it's in an user mode.
  68.  
  69. CR_JMPDraw ¹     : ColourRequester will jump to that address (d0=^Window)
  70.                    after the window has been opened.
  71.  
  72. CR_ScreenTitle   : pointer to screen title.
  73.  
  74. CR_DefaultWTitle : default window title
  75.  
  76.  
  77. ¹ These vectors should be used by programmers. If you don't want to insert
  78.   any  routine, they should be zero.
  79.  
  80.  
  81. The next part is used by the ColourRequester . To run the ColourRequester
  82. they should be zero.
  83.  
  84.  
  85. CR_imClass       : Class of IntuiMesaage
  86.  
  87. CR_imCode        : Code of IntuiMesaage
  88.  
  89. CR_imQualifier   : Qualifier of IntuiMesaage
  90.  
  91. CR_imIAddress    : IAddress of IntuiMesaage
  92.  
  93. CR_imMouseX      : MouseX of IntuiMesaage
  94.  
  95. CR_imMouseY      : MouseY of IntuiMesaage
  96.  
  97. CR_WindowPointer : Pointer to window struktur
  98.  
  99. CR_UndoSize      : number of entries in the  undo colortable
  100.  
  101. CR_UndoBuffer    : pointer to undo colortable
  102.  
  103. CR_Undo          : RGB of current colour
  104.  
  105. CR_Colour        : number of current colour
  106.  
  107. CR_MemorySize    : size of allocated memory.
  108.  
  109. CR_Memory        : pointer to allocated memory.
  110.  
  111. CR_NewWindow     : pointer to NewWindow strukture
  112.  
  113. CR_Mode          : Mode, e.g. COPY,EXCHANGE or SPREAD.
  114.  
  115. CR_WindowTitle   : pointer to window title for new mode.
  116.  
  117. CR_Reserved      : ...
  118.  
  119.  
  120.  
  121.  
  122.    
  123.  
  124.  
  125.  
  126.  
  127.  
  128. How to use the ColourRequesters
  129. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  130.  
  131.  
  132. 1. easy - without own routines
  133. ------------------------------
  134.  
  135.    · init first part of the structure.
  136.  
  137.    · call ColourRequester . If it returns something negative, something
  138.      went wrong (no memory, OpenWindow failed..)
  139.  
  140.  
  141.    
  142. example : DEMO_I
  143.  
  144.  
  145.  
  146. 2. insert own routines
  147. ----------------------
  148.  
  149. If you want to modify the NewWindow structure (e.g. add IDCMAP flags)
  150. use the CR_JMPWindow vector. GADGETDOWN and GADGETUP are already set.
  151. You may also add your own gadgets. Use gg_NextGadget to get to the
  152. last gadget and insert your one but NEVER USE A OFFSETS TO GET TO THE LAST
  153. GADGET ! To avoid any problems bit 15 of GadgetID should be set.
  154.  
  155. Use CR_JMPDraw if you want to draw something into the window.
  156.  
  157. If the ColourRequester receives any message which doesn't belong to a
  158. ColourRequester gadget the CR_JMPMessage vector will be used. All the
  159. message information are put into the second part of the ColourRequester
  160. structure.
  161.  
  162. There are two types of functions :
  163.  
  164. · Functions which are executed immediately.             e.g. ANTIQUE
  165. · Functions which need a second colour to be selected.  e.g. COPY
  166.  
  167. If you function belongs to the fist type you must tell the ColourRequester
  168. how to react (d0) :
  169.  
  170. · CR_NOTHING        : Nothing will happen.
  171.  
  172. · CR_REMAKE         : The whole window is redrawn (e.g. after changing
  173.                       the window size).
  174.  
  175. · CR_EXIT           : The Requester will disapper.
  176.  
  177. · CR_NEWCOLOUR      : There's a new colour number in CR_Colour so the prop
  178.                       gadgets have to been refreshed.
  179.  
  180. · CR_UPDATECOLOUR   : RGB of the current colours have been changed. The
  181.                       prop gadgets have to been refreshed.
  182.  
  183.  
  184. Copy the code to d0, finish the routine by "RTS".
  185.  
  186.  
  187. If your function needs a second colour you have to tell it to the
  188. user by changing the window title. So CR_WindowTitle should
  189. contain the pointer to the new title. But also the ColourRequester
  190. must know that it's in a different mode. Write you Mode ID to
  191. CR_Mode (bit 31 should be set to avoid any problems). Return CR_Mode
  192. in d0. If the user now clicks a colour the ColourRequester will jump
  193. to CR_JMPMode. Now d0 contains the number of the selected colour.
  194. Now execute your function , clear CR_Mode and copy CR_DefaultWTitle
  195. to CR_WindowTitle. Return a code listed above.
  196.  
  197. Rem.: If your function is selected a second time instead of clicking
  198. a second colour cancel the function, clear CR_Mode and copy 
  199. CR_DefaultWTitle to CR_WindowTitle.
  200.  
  201.  
  202.    
  203. example : DEMO_II
  204.  
  205.  
  206.  
  207.  
  208.  
  209.